package com.example.t410.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.t410.service.MusicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/music")
public class MusicController {
    private JSONObject jsonObject = new JSONObject();
    @Autowired
    MusicService musicService ;
    @GetMapping("/getAll")
    public JSONObject getAll() {
        jsonObject.clear();
        jsonObject.put("status", 200);
        jsonObject.put("code",1);
        jsonObject.put("data", musicService.findAll());
        return jsonObject;
    }
}
